package com.duobao.server;

import java.util.*;
public abstract class WuGong 
{
    protected int category;//武功类别：1特殊，2基本
    protected int category2;//武功类别：1刀，2剑，3拳，4杖,5斧,6戟,7内功,8轻功,9招架,

    protected float xishu;//武功系数
    protected int tezhaoshu;//攻击招数
    protected int zjiashu;//招架招数
    protected String name;//武功名字
    protected String describe;//武功描述
    protected int Lv;//武功等级
    protected int bengjijingyan;//本级已用潜能;
    protected int endurance;//武功熟练度
    protected WuGong PZwg=null;//配置武功
    protected boolean PZ;//配置
    protected String zhaozhiming[];
    protected int yaohai;
    public WuGong(int category,int category2,String name,int Lv)
    {
        this.category = category;
        this.category2 = category2;
        this.name = name;
        this.Lv = Lv;
        this.endurance = 0;
        this.PZ = false;
        this.yaohai=0;
    }
    //name1  出手，name2 被动
    public abstract String getchuzhao(int id,NPC npc1,NPC npc2);
    public abstract String getzhongzhao(int id,NPC npc1,NPC npc2);
    public abstract String getzhaojia(int id,NPC npc1,NPC npc2);
    public int getshenjijy()//获得升级经验
    {
        int result=0;
        if(this.category==1)
        {
            result=3*this.Lv*this.Lv;
        }else
        {
            result=this.Lv*this.Lv;
        }
        return result;
    }

    public int getTezhaoshu() {
        return tezhaoshu;
    }
    public void setTezhaoshu(int tezhaoshu) {
        this.tezhaoshu = tezhaoshu;
    }
    public int getZjiashu() {
        return zjiashu;
    }
    public void setZjiashu(int zjiashu) {
        this.zjiashu = zjiashu;
    }
    public float getXishu() {
        return xishu;
    }
    public void setXishu(float xishu) {
        this.xishu = xishu;
    }
    public int getBengjijingyan() {
        return bengjijingyan;
    }

    public void setBengjijingyan(int bengjijingyan) {
        this.bengjijingyan = bengjijingyan;
    }

    public void addBengjijingyan(int addjingyan) {

        if(this.bengjijingyan+addjingyan<this.getshenjijy())
        {
            this.bengjijingyan=this.bengjijingyan+addjingyan;
        }else
        {
            int shengji=this.getshenjijy()-this.bengjijingyan;
            int shengxi=addjingyan-shengji;
            this.sjiLV();
            this.bengjijingyan=shengxi;
        }

    }


    public boolean isPZ() {
        return PZ;
    }
    public void setPZ(boolean pZ) {
        PZ = pZ;
    }
    public String getDescribe() {
        return describe;
    }
    public void setDescribe(String describe) {
        this.describe = describe;
    }
    public int getCategory() {
        return category;
    }
    public void setCategory(int category) {
        this.category = category;
    }
    public int getCategory2() {
        return category2;
    }
    public void setCategory2(int category2) {
        this.category2 = category2;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public void sjiLV()//升级
    {
        this.Lv=this.Lv+1;
        this.bengjijingyan=0;
        this.setEndurance();
    }
    public int getLv() {
        return Lv;
    }
    public void setLv(int lv) {
        this.Lv=lv;
    }
    public void gxLv() {
        if(this.endurance>=100)
        {
            this.Lv = this.Lv+this.endurance/100;
            this.endurance = this.endurance%100;
        }
    }

    public int getEndurance() {
        return endurance;
    }
    public void setEndurance() {
        this.endurance=(int)(100*((float)this.bengjijingyan/(float)this.getshenjijy()));
    }
    public WuGong getPZWg() {
        return PZwg;
    }
    public void setPZWg(WuGong wg) {
        this.PZwg = wg;
    }
}
